﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SuperSocket.SocketBase.Protocol;

namespace TcpServer.PHORPServer
{
    public class PHORPProtocolRequestInfo : IRequestInfo
    {
        /// <summary>
        /// [不使用]
        /// </summary>
        public string Key { get; set; }

        /// <summary>
        /// DTYPE 设备类型, 1字节, PHORP控制器 固定为 0
        /// </summary>
        public string DTYPE { get; set; }

        /// <summary>
        /// DTYPE 设备地址, 4字节, 如地址为 999(0x3E7), DAddr = 0xE7 0x03 0x00 0x00
        /// </summary>
        public string DAddr { get; set; }

        /// <summary>
        /// DTYPE 设备地址,用于显示
        /// </summary>
        public string DAddrReverse { get; set; }

        /// <summary>
        /// 帧序号, 2字节, 为帧序列号
        /// </summary>
        public string seq { get; set; }
        public int seqDec { get; set; }

        /// <summary>
        /// 长度,2字节,  为 C 到 CS(包含)的长度
        /// </summary>
        public string Len { get; set; }
        public int LenDec { get; set; }

        /// <summary>
        /// 为控制码，最高位为0表示主动发出方，最高位为1表示 回复方
        /// </summary>
        public string C { get; set; }

        /// <summary>
        /// 寄存器地址，2字节, 如地址是 123 (0x7B) ,Addr = 0x7B 0x00
        /// </summary>
        public string Addr { get; set; }
        public int AddrDec { get; set; }

        /// <summary>
        /// Data 的长度，2字节
        /// </summary>
        public string DLen { get; set; }
        public int DLenDec { get; set; }

        /// <summary>
        /// 数据
        /// </summary>
        public string Data { get; set; }

        /// <summary>
        /// CS
        /// </summary>
        public string CS { get; set; }

        /// <summary>
        /// 当前完整帧
        /// </summary>
        public string EntireFrame { get; set; }
    }
}
